﻿#region << 文 件 说 明 >>

/*----------------------------------------------------------------
// 文件名称：UcViewBase
// 创 建 者：杨程
// 创建时间：2021/10/11 19:36:09
// 文件版本：V1.0.0
// ===============================================================
// 功能描述：
//
//
//----------------------------------------------------------------*/

#endregion

namespace Vampirewal.Core.WPF.Theme;

public class UcViewBase : UserControl, IUcViewBase
{
    static UcViewBase()
    {
        DefaultStyleKeyProperty.OverrideMetadata(typeof(UcViewBase), new FrameworkPropertyMetadata(typeof(UcViewBase)));
    }

    public UcViewBase()
    {
        //构造函数
        ViewId = Guid.NewGuid();
    }

    #region 属性

    /// <summary>
    /// 数据上下文
    /// </summary>
    public virtual ViewModelBase DataSource { get; set; }

    /// <summary>
    /// UserControlID
    /// </summary>
    public Guid ViewId
    {
        get;
    }

    /// <summary>
    /// 对应ViewModelKey
    /// </summary>
    /// <returns></returns>
    public virtual string ViewModelKey { get; }

    /// <summary>
    /// 窗体样式引用
    /// </summary>
    protected ResourceDictionary res
    {
        get
        {
            return new ResourceDictionary() { Source = new Uri("pack://application:,,,/Vampirewal.Core.WPF.Theme;component/Theme.xaml", UriKind.RelativeOrAbsolute) };
        }
    }

    #endregion

    #region 依赖属性

    public string Title
    {
        get { return (string)GetValue(TitleProperty); }
        set { SetValue(TitleProperty, value); }
    }

    // Using a DependencyProperty as the backing store for Title.  This enables animation, styling, binding, etc...
    public static readonly DependencyProperty TitleProperty =
        DependencyProperty.Register("Title", typeof(string), typeof(UcViewBase), new PropertyMetadata(""));

    #endregion
}